
#include <iostream>

using namespace std;
#define MAXN 50000



int main()
{
	int cn=0;
	cin>>cn;
	for(int n=0;n<cn;n++)
    {
		cout<<"Case "<<n+1<<":"<<endl;
		int dt[MAXN];
		int dn;
		cin >> dn;
		for(int i=0;i<dn;i++)
			cin>>dt[i];
		char comd[50];
		int a1,a2,t;
		for(;;)
		{
			cin>> comd;
			if(comd[0]=='E'||comd[0]=='e')
				break;
			switch(comd[0])
			{
			case 'q':
			case 'Q':
				cin>> a1;
				cin>> a2;
				if (a1>a2){t=a1;a1=a2;a2=t;}
				t=0;
				for(;a1<=a2;a1++)
					t+=dt[a1-1];
				cout<< t<<endl;
				break;
			case 's':
			case 'S':
				cin>> a1;
				cin>> a2;
				dt[a1-1]-=a2;
				break;
			case 'a':
			case 'A':
				cin>> a1;
				cin>> a2;
				dt[a1-1]+=a2;
				break;
			}
		}
	}
	return 0;
}
